package com.xiaobaibai.vo;

import com.xiaobaibai.entity.User;
import com.xiaobaibai.entity.UserInfo;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class UserVo {

    private Integer userId;//用户id

    private String userName;//用户昵称

    private String userImage;//用户头像

    private Boolean userGender;//用户性别

    private BigDecimal userAmount;//消费金额

    private Integer userIntegral;//用户积分

    private Integer userOrderQuantity;//用户订单数量

    private Date userLastLogin;//用户最后一次登录时间

    private Date userCreateTime;//创建时间

    public static UserVo coverUser(User user, UserInfo userInfo){
        UserVo userVo=new UserVo();
        userVo.setUserId(user.getUserId());
        userVo.setUserName(user.getUserName());
        userVo.setUserImage(user.getUserImage());
        userVo.setUserGender(user.getUserGender());
        userVo.setUserAmount(userInfo.getUserAmount());
        userVo.setUserIntegral(userInfo.getUserIntegral());
        userVo.setUserOrderQuantity(userInfo.getUserOrderQuantity());
        userVo.setUserLastLogin(user.getUserLastLogin());
        userVo.setUserCreateTime(user.getUserCreateTime());
        return userVo;
    }

}
